home *** CD-ROM | disk | FTP | other *** search
/ VRML Browsing & Building Cyberspace / VRML - Browsing and Building Cyberspace.iso / examples / eightnth.wrl < prev    next >
Text File  |  1995-06-14  |  3KB  |  107 lines

  1. #VRML V1.0 ascii
  2.  
  3. # Example eighteen - We reference the Sun using WWWInline
  4.  
  5. # Here comes the Sun
  6. # The Separator node groups everything within it together
  7. DEF SOLAR_SYSTEM Separator {
  8.  
  9.     # The material will effect all subsequent nodes
  10.     # The sun is yellow, isn't it?  Additive color means red + green = yellow
  11.     # We're switching to emissive color because the Sun gives off light.
  12.     Material {
  13.         emissiveColor 1 1 0        # The Sun emits lots of yellow light
  14.     }
  15.  
  16.     # We'll make the Sun shine here
  17.     # A PointLight shines equally in all directions, like the Sun does.
  18.     DEF SUNLIGHT PointLight {
  19.         intensity 1        # The Sun is way bright
  20.         color 1 1 0.9   # Sunlight is basically white, even though the Sun is yellow.
  21.     }
  22.  
  23.     # The WWWAnchor node is a group node
  24.     # This means that all objects within it are linked with the anchor's URL
  25.     # We want to link the Sun, so the Sun's Sphere node goes inside of it.
  26.     # Using the description field, we provide context for the user
  27.     # The DEF node attaches the name "SUN" to the WWWAnchor group
  28.     DEF SUN WWWAnchor {
  29.         name "http://www.w3.org/" # The root URL of the World Wide Web
  30.         description "A link from the Sun to W3.ORG" # Decriptive text
  31.  
  32.         # Inside the anchor, because WWWAnchor is a group node
  33.         # We reference using the WWWInline node
  34.         WWWInline {
  35.             name "http://hyperreal.com/~mpesce/book/examples/second.wrl"
  36.             bboxSize 10 10 10
  37.             bboxCenter 0 0 0
  38.         }
  39.     }
  40.  
  41.     # We place the Earth within it's own Separator
  42.     # To keep everything good and isolated
  43.     Separator {
  44.  
  45.         # Let's move things out of the way here
  46.         Transform {
  47.             translation 0 20 20
  48.         }
  49.  
  50.         # Color the Earth blue, and make it absorb light
  51.         # But also make it a reflective, like water
  52.         DEF EARTH_MATERIAL Material {
  53.             diffuseColor 0 0 1 # Big blue marble
  54.             specularColor 0.9 0.9 0.9 # And a little more shiny
  55.             shininess 0.9 # Water is rather shiny
  56.         }
  57.  
  58.         # The WWWAnchor node is a group node
  59.         # This means that all objects within it are linked with the anchor's URL
  60.         # We want to link the Earth, so the Earth's Sphere node goes inside of it.
  61.         # Using the description field, we provide context for the user
  62.         # The DEF node attaches the name "Earth" to the WWWAnchor node
  63.         DEF EARTH WWWAnchor {
  64.             name "http://hyperreal.com/~mpesce/book/examples/second.wrl" # Another world
  65.             description "A link to another world" # Decriptive text
  66.  
  67.             # Finally, create the earth
  68.             Sphere {
  69.                 radius 2    # Little Earth
  70.             }
  71.         }
  72.  
  73.         # The Moon gets its own Separator
  74.         # Because we really do keep everything separate
  75.         Separator {
  76.  
  77.             # The Moon is just outside the Earth
  78.             Transform {
  79.                 translation 4 4 0
  80.             }
  81.  
  82.             # Color the Moon grey, make it absorb light
  83.             # It's a little shiny, but not much
  84.             Material {
  85.                 diffuseColor 0.7 0.7 0.7
  86.                 shininess 0.3
  87.             }
  88.  
  89.             # The WWWAnchor node is a group node
  90.             # This means that all objects within it are linked with the anchor's URL
  91.             # We want to link the Moon, so the Moon's Sphere node goes inside of it.
  92.             # Using the description field, we provide context for the user
  93.             # The DEF node attaches the name "Moon" to the WWWAnchor node
  94.             DEF Moon WWWAnchor {
  95.                 name "http://www.cyborganic.com:80/People/paul/The_new_dogs/pescewrd.au"
  96.                 description "Sounds from a talk about VRML"
  97.  
  98.                 # And now, create the Moon
  99.                 Sphere {
  100.                     radius 1    # Tiny Moon
  101.                 }
  102.             }
  103.         }
  104.     }
  105. }
  106.  
  107.